<template>
	<div id="container">
		<div id="search_content">
		<el-form label-width="100px" size="large">
			<el-form-item label="用户ID:">
				<el-input placeholder="用户ID" v-model="user.userId"></el-input>
			</el-form-item>
			<el-form-item label="用户名:">
				<el-input placeholder="支持模糊查询" v-model="user.userName"></el-input>
			</el-form-item>
			<el-form-item label="性别:">
				<el-radio-group v-model="user.userSex">
					<el-radio label="1">男</el-radio>
					<el-radio label="2">女</el-radio>
				</el-radio-group>
			</el-form-item>
			<el-form-item>
				<el-button type="success" @click="search()">搜索</el-button>
			</el-form-item>
		</el-form>
		</div>
		<div id="search_result">
		<el-table :data="users"
			:border="true"
			:stripe="true">
			<el-table-column label="用户ID" prop="userId"></el-table-column>
			<el-table-column label="用户名" prop="userName"></el-table-column>
			<el-table-column label="性别" prop="userSex">
				<template #default="scope">
					{{scope.row.userSex==1?'男':'女'}}
				</template>
			</el-table-column>
		</el-table>
		</div>
	</div>
</template>

<script>
	export default{
		name:'UsersView',
		data(){
				return{
					user:{
						userId:'',
						userName:'',
						userSex:''
					},
					users:[]
				}
			},
			methods:{
				search(){
					this.$axios.post("http://localhost:8088/demo/user/findUsers",this.user)
					.then(rst=>{
						console.log(rst.data)
						this.users=rst.data.rst;
					}).catch(err=>{
						console.log(err)
					})
				}
			}
		}
</script>

<style>
</style>